$(function(){

	/*
	 * init the cancel event modal
	 */
	var $cancelEventModal = $('#cancel-event-modal');
	$cancelEventModal.modal({
		backdrop: 'static',
		keyboard: false,	
		show: false
	});
	$('#cancel-event-btn').on('click',function(){
		$cancelEventModal.modal('show');
	});

	$('#submit-cancel-event-btn').on('click',function(){
		var $this = $(this);
		var formData = {
				eventId: $("#eventId").val(),
				cancelReason: $("#cancelReason").val()
			};
		if(formData.cancelReason.trim()==""){
			greeting({title:'提示',msg:'请填写活动取消原因'});
			return false;
		}
		$cancelEventModal.modal('hide');
			cAjax({
				url: '/cms/event/cancelEvent',
				data: formData,
				success: function(obj) {
					greeting({msg:'活动取消成功'});
					$("#cancel-event-btn").addClass("disabled");
				}
		});
	});
	
	/*
	 * set the height of iframe
	 */
	$("#registeredPersonalList-iframe").load(function(){
		var mainheight = $(this).contents().find("body").height();
		$(this).height(mainheight);
	}); 

});
